void tabletTracking();
- void closeEvent();
-
private:
bool ensureScreenSize(int width, int height);
QTRY_COMPARE(widget.moveEventCount, 3);
}
-class CloseCountingWidget : public QWidget
-{
-public:
- int closeCount = 0;
- void closeEvent(QCloseEvent *ev) override;
-};
-
-void CloseCountingWidget::closeEvent(QCloseEvent *ev)
-{
- ++closeCount;
- ev->accept();
-}
-
-void tst_QWidget::closeEvent()
-{
- CloseCountingWidget widget;
- widget.show();
- QVERIFY(QTest::qWaitForWindowExposed(&widget));
- // Yes we call the close() function twice. This mimics the behavior of QTBUG-43344 where
- // QApplication first closes all windows and then QCocoaApplication flushes window system
- // events, triggering more close events.
- widget.windowHandle()->close();
- widget.windowHandle()->close();
- QCOMPARE(widget.closeCount, 1);
-}
-
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"